<template>
  <div class="outer">
    <h1>App</h1>
    {{list}}
    <!-- <button @click="destroyApp">卸载App组件</button> -->
    <List ref="listComp"></List>
  </div>
</template>

<script>
import _ from "lodash";
import List from "./components/List";
export default {
  name: "App",
  data() {
    return {
      list: [],
    };
  },
  components: {
    List,
  },
  mounted(){
    this.$refs.listComp.$on("atguigu",this.getListData)
  },
  methods: {
    getListData(list) {
      this.list = _.cloneDeep(list);

      //判断是否是深拷贝
      // console.log(this.list[0] === list[0]);
    },
  },
};
</script>

<style scoped>
.outer {
  height: 400px;
  background: yellowgreen;
}
</style>
